The present invention generally relates to scheduling of processes in a computer. More particularly, the invention aims at dynamically monitoring and adapting the priority of a tree of processes.
Process scheduling in operating systems dispatches processes for execution on the available CPUs of the computer. The scheduling algorithm must take into account the different types of processes which may have different CPU and I/O consumption. Also the scheduler of the operating system has to optimize global CPU usage and to respect a same CPU time for each thread.
Nowadays there are plenty of process-scheduling algorithms adopted by the modern operating systems to assign priorities to processes. The main purpose of such process-scheduling algorithms is to minimize resource starvation and to ensure fairness amongst the parties utilizing the resources. To achieve this goal, the operating system schedulers dynamically modify the actual priority of the process in their internal scheduling queue, for example by assigning a temporary priority burst to a process in specific situations (i.e. at the end of an I/O operation). Some operating systems, such as the IBM AIX® operating system (AIX is a trademark of International Business Machine Corp., registered in many jurisdictions worldwide, allow even to globally modify the adopted scheduling algorithm.
Additionally, operating systems usually provide commands and application programming interfaces (APIs) that can be used to modify and tune the priority of a specified set of processes. For this purpose, a set of system services are available in various operating systems: nice, renice for the Linux™ operating system (LINUX is a registered trademark of Linus Torvalds in the United States, other countries, or both); set_priority in the Java™ programming language (JAVA and all Java-based trademarks and logos are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both) and SetPriorityClass, SetThreadPriority are examples of process functions for Windows® operating system (Microsoft, Windows, Windows NT, and the Windows logo are trademarks of Microsoft Corporation in the United States, other countries, or both), a thread being a basic unit to which the operating system allocates processor time, a process being an executing application that consists of one or more threads.
Even if the scheduling algorithms generally do a good job in dispatching and assigning the right priorities to the executing processes, there are situations when the embedded scheduling policies are not enough to manage in an effective way how a specific set of processes have to be executed. Typical examples of such processes are long-running system management processes, such as the execution of an Inventory scan on a machine. These kinds of operations are usually long-running tasks comprising different phases with different characteristics from a CPU-I/O consumption point of view. They include very CPU-intensive phases followed by I/O-bound operations followed again by a CPU-bound phase and so on. Additionally, such tasks usually spawn child processes to perform some of the steps of the primary task.
Since each process started on an operating system has a fixed base priority (defined by the command used to spawn it) usually, a long-running process with time-varying characteristics from a CPU-usage and I/O-usage point of view may not be properly managed by the operating system scheduler during its whole life.
Starting such a long-running process with a lower base-priority would be good during the CPU-intensive phases so that other system activities, and in particular interactive applications, would not be disturbed too much. On the other hand, having a lower priority may degrade a lot the execution time during I/O intensive phases resulting in an overall long execution time. Vice versa, using a higher priority would be beneficial during the I/O intensive phases but would degrade a lot the responsiveness of the system for interactive applications during the CPU-intensive phases.
One solution to manage process priorities is implemented in the z/OS® Worload Manager product described in the IBM (z/OS is a trademark of International Business Machine Corp., registered in many jurisdictions worldwide) redbook SG24-6472-03 at: http://www.redbooks.ibm.com/abstracts/sg246472.html?Open
In z/OS® Workload Manager, a contract is made (Service Level Agreement, STA) between the installation (user) and the operating system. The installation classifies the work running on the z/OS® operating system in distinct service classes and defines goals for them that express the expectation of how the work should perform. These goal definitions are used, along with the different workload priorities, to manage the work across all systems of a sysplex environment. This ensures that defined SLAs get respected, and that, eventually, competing workload gets moved to different regions. This control on priority of process execution does not answer the need for adapting priority of a running process as it changes its behavior during the execution in the context of a single machine (i.e. a desktop computer).